const express = require('express');
const router = express.Router();
const fs = require('fs');
const bodyParser = require('body-parser');
router.use(bodyParser.urlencoded({ extended: false }));
router.get('/a', (req, res) => {
    // res.send('get index');
    res.send(req.query);
});
router.post('/a', (req, res) => {
    // res.send('post index');
    // res.send(req.body);
    fs.writeFile('./record.txt',JSON.stringify(req.body),(err)=>{
        if(err == null){
            res.send('Success');
        }else{
            res.send('Fail');
        }
    });
});
module.exports = router;